<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ taglib uri="/WEB-INF/tlds/att.tld" prefix="att"%>
<html>
<head>
<meta name="decorator" content="moduleView" />

<script type="text/javascript">
	function getUrl(url) {
		$("#versionFrame").attr("src", url);
	}
	
	function submitForm(stauts){
		$("#status").val(stauts);
		statementInvoiceForm.submit();
		$('#approvalId').attr("disabled","true");
		$('#bacKId').attr("disabled","true");

	}
</script>
</head>
<body>
	<div class="Report_f">
		<div class="Report_f_1">
			<div class="Report_f_title_1">供应商开票信息</div>
			<div class="o-l-action">
				<a class="btn btn-default btn-sm btn_5 pull-right" role="button"
					href="javascript:void(0)" onclick="history.go(-1)">返回</a>
				<c:if test='${statementInvoice.status=="21"}'>
					<a class="btn btn-primary btn-sm btn_5 pull-right" role="button"
						href="${contextPath}/biz/statement/invoice/update/view?id=${statementInvoice.id}">修改</a>
				</c:if>
				<a class="btn btn-primary btn-sm btn_5 pull-right" role="button"
					href="${contextPath}/biz/statement/invoice/export/${statementInvoice.id}/detail">导出Excel</a>
				<a class="btn btn-success btn-sm btn_5 pull-right" role="button"
							href="${contextPath}/biz/statement/invoice/print?id=${statementInvoice.id}">打印</a>	
			</div>
			<div class="tab-content Report_f_title_3">
				<div class="Report_f_title_5">
					<div class="tab-content Report_f_title_3">
						<div class="tab-pane active" id="label_1">
						  <div class="Report_f_title_4">
							  <form:form id="statementInvoiceForm" name="statementInvoiceForm" modelAttribute="statementInvoice" action="${contextPath}/biz/statement/invoice/approval" method="post"
								   class="form-inline" role="form" onsubmit="return check()">
					           	   <form:hidden path="id"/>
					           	   <form:hidden path="status"/>
					           	   <form:hidden path="approvalDate"/>
					           	   <form:hidden path="approver"/>
					           	   <form:hidden path="supplierNo"/>
					               <form:hidden path="supplierName"/>
								<div class="f_2">
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_4">供应商编号:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">${statementInvoice.supplierNo}</div>
										</div>
									</div>
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">供应商名称:</label>
										<div class="col-sm-8 f_6">
											${statementInvoice.supplierName}</div>
									</div>
								</div>
								<div class="f_3">
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">供应商合同号:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">
												${statementInvoice.contractNumber}</div>
										</div>
									</div>
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">结算单号:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">${statementInvoice.billNo}</div>
										</div>
									</div>
								</div>
								<div class="f_2">
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_4">结算开始日期:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">
												<fmt:formatDate value="${statementInvoice.startDate}"
													pattern="yyyy-MM-dd" />
											</div>
										</div>
									</div>
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">结算结束日期:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">
												<fmt:formatDate value="${statementInvoice.endDate}"
													pattern="yyyy-MM-dd" />
											</div>
										</div>
									</div>
								</div>
								<div class="f_3">
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_4">区域:</label>
										<div class="col-sm-8 f_6">
											<div class="input-group">
												<ossp:select name="regionCode"
													value="${statementInvoice.regionCode}"
													service="selectOneRegionService"
													htmlEleProperties="disabled=\"disabled\""></ossp:select>
											</div>
										</div>
									</div>
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">分店:</label>
										<div class="col-sm-8 f_6">
											<div class="input-group">
												<ossp:select name="shopCode"
													value="${statementInvoice.shopCode}"
													service="selectOneShopService"
													htmlEleProperties="disabled=\"disabled\""></ossp:select>
											</div>
										</div>
									</div>
								</div>
								<div class="f_2">
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">应开票金额:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">
												${statementInvoice.billingAmount}</div>
										</div>
									</div>
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">未含税金额:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">
												${statementInvoice.billedAmount}</div>
										</div>
									</div>
								</div>
								<div class="f_2">
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">税额:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">
												${statementInvoice.taxAmount}</div>
										</div>
									</div>
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">已开票金额:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">${statementInvoice.totalAmount}</div>
										</div>
									</div>
								</div>
								<div class="f_3">
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_4">未开票金额:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">${statementInvoice.unbilledAmount}</div>
										</div>
									</div>
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">楼层:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">${statementInvoice.floorName}</div>
										</div>
									</div>
								</div>
								<div class="f_2">
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">审批状态:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">
												<ossp:value dictType="approvalStatus"
													key="${statementInvoice.status}"></ossp:value>
											</div>
										</div>
									</div>
									<div class="form-group col-sm-6">
										<label for="inputtext3" class="col-sm-4 control-label f_7">审批人:</label>
										<div class="col-sm-8 f_6">
											<div class="col-sm-7 f_14">${statementInvoice.approverName}</div>
										</div>
									</div>
								</div>
								<c:if test="${statementInvoice.status > 20}">
									<div class="f_3">
										<div class="form-group col-sm-6">
											<label for="inputtext3" class="col-sm-4 control-label f_4">审批时间:</label>
											<div class="col-sm-8 f_6">
												<div class="col-sm-7 f_14">
													<fmt:formatDate value="${statementInvoice.approvalDate}"
														pattern="yyyy-MM-dd" />
												</div>
											</div>
										</div>
										<div class="form-group col-sm-6">
											<label for="inputtext3" class="col-sm-4 control-label f_7">审批意见:</label>
											<div class="col-sm-8 f_6">
												<div class="col-sm-7 f_14">
													${statementInvoice.approvalOpinion}</div>
											</div>
										</div>
									</div>
								</c:if>
								<div class="f_2">
									<h4>发票明细</h4>
									<table class="table table-striped o-l-table">
										<thead>
											<tr>
												<th style="width: 140px">发票号码</th>
												<th style="width: 120px">税率</th>
												<th style="width: 14%">价税合计金额</th>
												<th style="width: 12%">税额</th>
												<th style="width: 15%">联系电话</th>
												<th>备注</th>
											</tr>
										</thead>
										<tbody>
											<c:forEach items="${statementInvoice.invoiceDetailList}"
												var="itemCode" varStatus="var">
												<tr>
													<td>${itemCode.invoiceCode}</td>
													<td>${itemCode.taxRate}%</td>
													<td>${itemCode.totalAmount}</td>
													<td>${itemCode.taxAmount}</td>
													<td>${itemCode.contactNumber}</td>
													<td>${itemCode.remark}</td>
												</tr>
											</c:forEach>
										</tbody>
									</table>
								</div>
								<shiro:hasPermission name="com.maoye.ossp.biz.statement.StatementInvoice:approve">
								<div class="f_3">
									<h4>审批</h4>
									<div class="form-group col-xs-12">
										<label for="inputtext3" class="col-lb-1 control-label f_10">审批意见：</label>
										<div class="col-sm-10 col-lb-2 f_6">
											<form:textarea path="approvalOpinion" rows="3"
												cssClass="form-control f_11" />
										</div>
									</div>
								</div>
								<div class="f_12">
									<c:if test="${statementInvoice.status=='20'}">
										<button type="button" id="bacKId"
											class="btn btn-warning btn_5 btn_right"
											onclick="submitForm('21')">驳&nbsp;回</button>
										<button type="button" id="approvalId"
											class="btn btn-success btn_5 btn_right"
											onclick="submitForm('30')">通&nbsp;过</button>
									</c:if>
								</div>
								</shiro:hasPermission>
								</form:form>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>